package wpmp.security.mgr.inteceptor;

import org.apache.log4j.Logger;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

/**
 * 记录Action中抛出的异常至日志
 * @author Wayne.Wang<5waynewang@gmail.com>
 * @since 11:09:32 AM Dec 21, 2012
 */
public class LogErrorInterceptor extends AbstractInterceptor {

	private static final long serialVersionUID = 4431816727461171175L;

	private static final Logger LOG = Logger.getLogger("ActionErrorLogger");

	@Override
	public String intercept(ActionInvocation arg0) throws Exception {
		try {
			return arg0.invoke();
		}
		catch (Exception e) {
			LOG.error(e.getMessage(), e);
			throw e;
		}
	}
}
